package chapter09.proxy;
import java.awt.*;
import javax.swing.*;
public class SgHouseProxy {
	public static void main(String[] args) {
		HouseProxy proxy = new HouseProxy();
		proxy.display();
	}
}
//抽象主题：房主
interface HouseOwner
{
	void display();
}
//真实主题：韶关碧桂园
class SgBiguiyuan extends JFrame implements HouseOwner
{
	private static final long serialVersionUID = 1L;
	public SgBiguiyuan()
	{
		super("房产中介代售韶关碧桂园房子");       		      
	}
	public void display()
    {		
		this.setLayout(new GridLayout(1,1));
		JLabel l1 = new JLabel(new ImageIcon("src/chapter09/proxy/SgBiguiyuan.jpg"));
		this.add(l1);	
        this.pack(); 
		this.setVisible(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    }
}
//代理：房产中介
class HouseProxy implements HouseOwner
{
	private SgBiguiyuan realSubject = new SgBiguiyuan();
    public void display()
    {
    	preRequest();
        realSubject.display();
        postRequest();
    }
    public void preRequest()
    {
  	    System.out.println("房产中介介绍韶关碧桂园房子。");
    }
    public void postRequest()
    {
  	    System.out.println("房产中介登记购房者信息。");
    }
}
